import http from "@/api/http";

//获取所有管理员的数据
export const postAdminList = (params: any) => {
  return http.post(`/adminInfo/list`, params);
};

//新增管理员（只有超级管理员增加的）
export const postAdminAdd = (params: any) => {
  return http.post(`/admin/add`, params);
};

//图片上传临时adminInfo/upload/avatar
// export const postAdminAvatar = (params: any) => {
//   return http.post(`adminInfo/upload/avatar`, params);
// };
// 图片上传临时：/adminInfo/upload/avatar
export const postAdminAvatar = (formData: FormData) => {
  return http.post(`/adminInfo/upload/avatar`, formData, {
    headers: {
      "Content-Type": "multipart/form-data"
    }
  });
};

// 删除管理员（支持传 id）
export const deleteAdminById = (adminId: string) => {
  return http.delete(`/admin/delete/${adminId}`);
};

//修改管理员信息
export const putAdminInfo = (data: any) => {
  return http.put(`/adminInfo/update`, data);
};
